package acm.pta5;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class T1_7 {
    public static void main(String[] args) throws IOException {
        BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
        String[] read=null;
        int n = Integer.parseInt(in.readLine());
        while (n-- > 0) {
            read=in.readLine().split(" ");
            double breathe = Double.parseDouble(read[1]);
            double pulse = Double.parseDouble(read[2]);
            if (breathe<15||breathe>20||pulse<50||pulse>70){
                System.out.println(read[0]);
            }
        }
    }
}
